package com.yugao.fintech.antelope.mps.service.impl;

import com.github.yitter.idgen.YitIdHelper;
import com.yugao.fintech.antelope.mps.api.MsgPushApi;
import com.yugao.fintech.antelope.mps.api.model.rqrs.CheckAuthUserCaptchaReq;
import com.yugao.fintech.antelope.mps.api.model.rqrs.CheckNoAuthUserCaptchaReq;
import com.yugao.fintech.antelope.mps.api.model.rqrs.MsgPushParam;
import com.yugao.fintech.antelope.mps.api.model.rqrs.SendCaptchaMsgReq;
import com.yugao.fintech.antelope.mps.core.propcess.MsgPushProcess;
import com.yugao.fintech.antelope.mps.service.CaptchaMessageService;
import com.yugao.fintech.framework.validation.ValidationUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

@Primary
@Service
public class MsgPushApiImpl implements MsgPushApi {
    @Autowired
    private MsgPushProcess msgPushHandler;

    @Autowired
    private CaptchaMessageService captchaMessageService;

    @Override
    public void push(MsgPushParam req) {
        ValidationUtils.validateAll(req);
        msgPushHandler.push(req, String.valueOf(YitIdHelper.nextId()));
    }

    @Override
    public void checkNoAuthUserCaptcha(CheckNoAuthUserCaptchaReq req) {
        captchaMessageService.checkNoAuthUserCaptcha(req);
    }

    @Override
    public void checkAuthUserCaptcha(CheckAuthUserCaptchaReq req) {
        captchaMessageService.checkAuthUserCaptcha(req);
    }

    @Override
    public void sendNoAuthUserCaptcha(SendCaptchaMsgReq req) {
        captchaMessageService.sendNoAuthUserCaptcha(req);
    }


}
